Xceed Toolkit Plus for WPF v5.0 Documentation
In This Topic
    Grouping data items
    In This Topic

    The following example demonstrates how to group the data items by the ShipCountry and ShipCity columns.  

    XAML
    Copy Code
    <Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid">
      <Grid.Resources>
        <xcdg:DataGridCollectionViewSource x:Key="cvs_orders"
                                        Source="{Binding Source={x:Static Application.Current},
                                                          Path=Orders}">      
         <xcdg:DataGridCollectionViewSource.GroupDescriptions>        
           <xcdg:DataGridGroupDescription PropertyName="ShipCountry"/>
           <xcdg:DataGridGroupDescription PropertyName="ShipCity"/>
         </xcdg:DataGridCollectionViewSource.GroupDescriptions>
        </xcdg:DataGridCollectionViewSource>
      </Grid.Resources>
      
      <xcdg:DataGridControl x:Name="OrdersGrid"
                            ItemsSource="{Binding Source={StaticResource cvs_orders}}">    
      </xcdg:DataGridControl>
    </Grid>
    VB.NET
    Copy Code
    Dim collectionView As New DataGridCollectionView( Orders )
    collectionView.GroupDescriptions.Add( New DataGridGroupDescription( "ShipCountry" ) )
    collectionView.GroupDescriptions.Add( New DataGridGroupDescription( "ShipCity" ) )
    dataGridControl.ItemsSource = collectionView
    C#
    Copy Code
    DataGridCollectionView collectionView = new DataGridCollectionView( Orders );
    collectionView.GroupDescriptions.Add( new DataGridGroupDescription( "ShipCountry" ) );
    collectionView.GroupDescriptions.Add( new DataGridGroupDescription( "ShipCity" ) );
    dataGridControl.ItemsSource = collectionView;